using System;
using Sinacor.OMM.Translator.Interfaces;
using Sinacor.OMM.MessageEntity;

namespace Sinacor.OMM.Translator.Translators.STM
{
	public class Message0100 : BaseTranslator, ITranslator
    {        
        private static Message0100 _instance = null;

        private Message0100()
        {            
        }

        public static Message0100 GetInstance()
        {
            if (_instance == null)
                _instance = new Message0100();

            return _instance;
        }

        #region itranslator members

        

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Sinacor.OMM.MessageEntity.BaseMessage TranslateToRouterMessage()
        {
            return TranslateToMessage();
        }        

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Sinacor.OMM.MessageEntity.BaseMessage TranslateToProcessMessage()
        {
            throw new System.NotImplementedException();
        }

        #endregion                

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private Sinacor.OMM.MessageEntity.BaseMessage TranslateToMessage()
        {
            Sinacor.OMM.MessageEntity.STM.Message0100 _message = new Sinacor.OMM.MessageEntity.STM.Message0100();
            Sinacor.OMM.MessageEntity.BaseMessage baseMessage;
            
            _message.MegaBolsaIdentificator = Sinacor.OMM.MessageEntity.Enum.MessagesMegaBolsaSource.NotificacaoCancelamentoNegocio;
            _message.Source = Sinacor.OMM.MessageEntity.Enum.MessageSource.MegaBolsa;
            _message.Original = OriginalMessage.Body;

            baseMessage = TranslateMessageLabel(OriginalMessage.Label);
            _message.SequentialID = baseMessage.SequentialID;
            _message.ID = baseMessage.ID;
            _message.OperationDate = GetOperationDate(_message.ID);

            return _message;
        }
    }
}